package com.bsj.power.system.web;

import com.bsj.power.common.config.global.JsonResult;
import com.bsj.power.system.service.ScheduledTasksService;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author LiJiaXin
 * @version 1.0.0
 * @description ScheduledTasksController
 * @time 2024/8/26 19:31
 */
@RestController
@RequestMapping("/system/scheduledTasks")
public class ScheduledTasksController {

    @Autowired
    private ScheduledTasksService scheduledTasksService;

    /**
     * 设置工单定时任务
     *
     * @param second
     * @return com.bsj.power.common.config.global.JsonResult
     * @author ljx
     * @time 2024/8/26 19:29
     */
    @GetMapping("/setJobTasks")
    public JsonResult setJobTasks(Integer second) throws SchedulerException {
        return scheduledTasksService.setJobTasks(second);
    }

    /**
     * 获取工单定时任务时间间隔
     *
     * @return com.bsj.power.common.config.global.JsonResult<java.lang.Integer>
     * @author ljx
     * @time 2024/8/28 10:19
     */
    @GetMapping("/getJobTasksTimeInterval")
    public JsonResult<Integer> getJobTasksTimeInterval(){
        return scheduledTasksService.getJobTasksTimeInterval();
    }

}
